package com.pactera.madp.cp.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.pactera.madp.common.core.util.R;
import com.pactera.madp.cp.api.dto.channel.*;
import com.pactera.madp.cp.api.em.permission.ReqPerEnum;
import com.pactera.madp.cp.api.entity.channel.ChannelCodeEntity;
import com.pactera.madp.cp.api.vo.channel.*;
import org.apache.ibatis.annotations.Param;

import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.util.List;
import java.util.Map;

/**
 * @author: yangpengwei
 * @time: 2021/2/22 4:59 下午
 * @description 渠道码服务
 */
public interface IChannelCodeService extends IService<ChannelCodeEntity> {

    /**
     * @author: yangpengwei
     * @time: 2021/3/2 2:39 下午
     * @description 获取渠道码详情
     */
    RespChannelCodeVO getChannelCodeDetail(Integer codeId);

    /**
     * @author: yangpengwei
     * @time: 2021/3/1 3:02 下午
     * @description 编辑渠道码所在分组
     */
    void updateGroupId(Integer codeId, Integer codeGroupId);

    void updateGroupId(ChannelCodeGroupMoveDTO dto);

    /**
     * @author: yangpengwei
     * @time: 2021/3/1 3:00 下午
     * @description 获取渠道码 - 客户列表
     * @return
     */
    R getChannelCodeContactByReq(Integer channelCodeId, Page page);

    /**
     * @author: yangpengwei
     * @time: 2021/3/1 3:00 下午
     * @description 获取渠道码列表
     */
    R getChannelCodePageByReq(ReqChannelCodeListDTO req, Page page, ReqPerEnum permission);

    /**
     * @author: yangpengwei
     * @time: 2021/3/3 2:26 下午
     * @description 获取渠道码中的欢迎语 map
     * map["welcomeContent"] = 文本内容
     * map["content"] = json 内容: appid小程序, imageLink 图文, 没有前两者的是图片
     */
    Map<String, Object> getWelcomeMsgMap(Integer channelCodeId,Integer corpId,String externalUserid,Integer employeeId);

    /**
     * @author: yangpengwei
     * @time: 2021/3/3 3:17 下午
     * @description 更新渠道码二维码所属成员信息
     */
    void updateChannelCodeQr(Integer channelCodeId,Integer corpId);


    boolean createChannelCode(ChannelCodeAddDTO channelCodeAddDTO);

    IPage<ChannelCodePageVO> pageList(ChannelCodePageDTO dto, Page page);

    boolean deleteChannelCode(Integer id);

    ChannelCodeDetailsVO channelCodeDetailsById(Integer id);

    boolean updateChannelCode(ChannelCodeUpdateDTO channelCodeUpdateDTO);

    void exitImagesByZip(ChannelCodeExitImageDTO dto, HttpServletResponse response,OutputStream out);

    ChannelCodeEntity getChannelCodeOne(@Param("channelId") Integer channelId, @Param("corpId") Integer corpId);

    void  saveTag(Integer corpId,Integer channelId,String externalUserid,Integer employeeId );

    void updateRemarkAndDescription(Integer corpId,Integer channelId,String externalUserid,Integer employeeId );

    List<ChannelCodeListVO> getList(String keyWords);

    List<ChannelCodeEmployeeListVO> getChannelCodeEmployeeList(ChannelCodeEmployeeListDTO dto);

}
